package org.breathe.protocal.decode;

import io.netty.buffer.ByteBuf;
import lombok.Getter;
import org.breathe.protocal.Resp;

/**
 * @author: breathe
 * @createTime: 2025-05-12
 */
@Getter
public class RespInteger extends Resp {
    private int content;
    public RespInteger(int content) {
        this.content = content;
    }
    @Override
    public void encode(Resp resp, ByteBuf buffer) {
        buffer.writeByte(':');
        buffer.writeBytes(String.valueOf(((RespInteger)resp).getContent()).getBytes());
        buffer.writeBytes(CRLF);
    }

    @Override
    public String toString() {
        return "RespInteger{" +
                "content=" + content +
                '}';
    }
}
